# Copyright (c) 2008-2009 Nokia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import os
import shutil

ensymble_dependencies = ['\\epoc32\\release\\armv5\\urel\\python_console.exe',
                      '\\epoc32\\release\\armv5\\urel\\python_ui.exe',
                      '..\\..\\..\\ext\\amaretto\\python_ui\\src\\launcher.py',
                      '..\\..\\..\\ext\\amaretto\\calendar\\src\\calendar.py',
                      '..\\..\\..\\ext\\amaretto\\socket\\src\\socket.py',
                      'prefix_data.txt']

${{if INCLUDE_INTERNAL_SRC
ensymble_dependencies.append('\\epoc32\\release\\${{DEVICE_PLATFORM}}\\${{DEVICE_BUILD}}\\Py_iad_client.dll');
}}

def generate_ensymble():
    if os.path.exists("templates"):
        shutil.rmtree("templates")
    os.mkdir("templates")
    for item in ensymble_dependencies:
        shutil.copy(item, ".\\templates")
    run_cmd = 'python squeeze\\squeeze.py -1 -o ensymble -b cmdmain ' \
    + 'cmdmain.py cmd_altere32.py cmd_genuid.py cmd_infoe32.py ' \
    + 'cmd_mergesis.py cmd_py2sis.py cmd_signsis.py cmd_simplesis.py ' \
    + 'cmd_version.py cryptutil.py miffile.py rscfile.py sisfield.py ' \
    + 'sisfile.py symbianutil.py defaultcert.py module_repo.py'
    os.system(run_cmd)


if __name__ == '__main__':
        generate_ensymble()
